<template>
  <div class="banner">
    <swiper :options="swiperOption" v-if="show">
      <!-- slides -->
      <swiper-slide v-for="item in list" :key="item.id">
        <img class="banner-img" :src="item.imgURL" alt="">
      </swiper-slide>
      <div class="swiper-pagination"  slot="pagination"></div>
      <!--<div class="swiper-button-prev" slot="button-prev"></div>-->
      <!--<div class="swiper-button-next" slot="button-next"></div> 控制左右箭头-->
      <!--<div class="swiper-scrollbar"   slot="scrollbar" 滚动条></div>-->
    </swiper>
  </div>
</template>
<script>
export default{
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  data: function () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination', // 加轮播下面的小圆点
        loop: true
      }
    }
  },
  computed: {
    show: function () {
      return this.list.length
    }
  }
}
</script>
<style lang="stylus" scoped>
  .banner >>> .swiper-pagination-bullets
    margin-bottom :0.18rem
  .banner >>> .swiper-pagination-bullet-active   // 穿透其他组件的样式
    background-color: #ffffff
  .banner
    width:100%
    height:0
    overflow :hidden
    padding-bottom :26.5%
    touch-action: none
  .banner-img
    width:100%
</style>
